﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Ylh.IDAL
{
   public  interface ICust
    {

        /// <summary>
        /// 插入一条客户信息
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="CustName">客户名称</param>
        /// <param name="BusinessStaffID">业务员编号</param>
        /// <param name="IsProtect">是否保护客户</param>
        /// <param name="CompanyName">公司名称</param>
        /// <param name="TelPhone">客户手机</param>
        /// <param name="CustAddress">客户地址</param>
        /// <param name="Legal">客户法人代表</param>
        /// <returns></returns>
       int InsertInto(string ConStr, string CustName, string BusinessStaffID, string IsProtect, string CompanyName, string TelPhone, string CustAddress, string Legal);

        DataTable GetCustByCodition(string ConStr, string condition);
        int CountProtect(string ConStr, string BusinessStaffID);

        /// <summary>
        /// 更新客户名称
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="CustName"></param>
        /// <param name="CustID"></param>
        /// <returns></returns>
        bool UpdateCustName(string ConStr, string CustName, string CustID);





        /// <summary>
        ///  更新客户的移交时间
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="CustID"></param>
        /// <returns></returns>
        bool UpdateTransferInfo(string ConStr, string CustID);



        /// <summary>
        /// 更新客户的保护状态
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="CustID">客户编号</param>
        /// <param name="IsProtect">是否是保护</param>
        /// <returns></returns>
        bool UpdateProtectInfo(string ConStr, string CustID, bool IsProtect);

        /// <summary>
        ///  指定客服人员
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="CustID"></param>
        /// <param name="ServerStaffID">客服人员编号</param>
        /// <returns></returns>
        bool UpdateServerInfo(string ConStr, string CustID, string ServerStaffID);



        /// <summary>
        /// 获取否个员工下面的所有客户
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="BusinessStaffID">业务员编号</param>
        /// <param name="isProtect"></param>
        /// <returns></returns>
        DataTable GetCustList(string ConStr, string BusinessStaffID, bool? isProtect);

       /// <summary>
        /// 获取否个员工下面的所有客户
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="BusinessStaffID"></param>
        /// <param name="isProtect"></param>
        /// <param name="?"></param>
        /// <returns></returns>
        DataTable GetCustList(string ConStr, string BusinessStaffID, bool? isProtect, int PageCurrent, int PageSize, ref int PageCount);
      

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        Ylh.Model.TbCust GetModel(string ConStr, int CustID);

        bool UpdateCustInfoBuss(string ConStr, Ylh.Model.TbCust model);



        /// <summary>
        /// 插入客户信息
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="model">客户信息对象</param>
        /// <returns></returns>
        int InsertCustInfo(string ConStr, Ylh.Model.TbCust model);
     
        /// <summary>
        /// 更新客户信息
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="model">客户对象</param>
        /// <returns></returns>
        bool UpdateCustInfo(string ConStr, Ylh.Model.TbCust model);


        /// <summary>
        /// 获取某个客服人员下面的客户
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="ServerStaffID">客服人员编号,如果为-1则获取未分配客服的客户</param>
        /// <returns></returns>
        DataTable GetCustList(string ConStr, int ServerStaffID);


        /// <summary>
        /// 删除客户信息
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="CustID">客户编号</param>
        /// <returns></returns>
        bool DeleteCust(string ConStr, string CustID);


        /// <summary>
        /// 更新客户信息
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="sql">数据库语句</param>
        /// <param name="model">客户对象</param>
        /// <returns></returns>
        bool UpdateCustServerInfo(string ConStr, string sql, Ylh.Model.TbCust model);




        DataTable GetCustListByCondition(string ConStr, string StaffID, bool? isProtect, bool IsDelet);



        /// <summary>
        /// 重载,获取指定员工的已经转移至客服经理的客户
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="BusinessStaffID">员工编号</param>
        /// <param name="IsTransfer">是否已经转移</param>
        /// <returns></returns>
        DataTable GetCustList(string ConStr, string BusinessStaffID, bool IsTransfer, string sTransfer);




        /// <summary>
        /// 获取已经有的意见
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="CustID">客户编号</param>
        /// <returns>当前意见,如果没有则返回空</returns>
        string GetOpinion(string ConStr, string CustID);
      
        /// <summary>
        /// 更新客户的意见
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="Opinion">意见</param>
        /// <param name="CustID"></param>
        /// <returns>成功为True,不成功为false</returns>
        bool UpdateOpinion(string ConStr, string Opinion, string CustID);


        /// <summary>
        /// 修改客户业务员
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="CustID">客户编号</param>
        /// <param name="StaffID">业务员编号</param>
        /// <returns></returns>
        bool UpdateBussinStaff(string ConStr, string CustID, string StaffID);

        DataTable GetCustList(string ConStr, string BusinessStaffID, bool IsTransfer, string sTransfer, int PageCurrent, int PageSize, ref int PageCount);


        /// <summary>
        /// 分页查找所需要的数据
        /// 2012年12月10日22:39:54
        /// </summary>
        /// <param name="ConStr">连接字符串</param>
        /// <param name="StaffID">相关客户</param>
        /// <param name="isProtect">是否保护</param>
        /// <param name="IsDelet">是否已经删除</param>
        /// <param name="PageCurrent">当前页</param>
        /// <param name="PageSize">每页记录数</param>
        /// <param name="PageCount">全部记录数</param>
        /// <returns>下一页的数据</returns>
        DataTable GetCustListByCondition(string ConStr, string StaffID, bool? isProtect, bool IsDelet, int PageCurrent, int PageSize, ref int PageCount);

        /// <summary>
        /// 重载获取客户的数据
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="BusinessStaffID"></param>
        /// <param name="isProtect"></param>
        /// <param name="PageCurrent"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageCount"></param>
        /// <param name="sqlwhere">用户选择的筛选的方法</param>
        /// <returns></returns>
        DataTable GetCustList(string ConStr, string BusinessStaffID, bool? isProtect, int PageCurrent, int PageSize, ref int PageCount, string sqlwhere);

        /// <summary>
        ///  重载获取客户数据
        /// </summary>
        /// <param name="ConStr"></param>
        /// <param name="BusinessStaffID"></param>
        /// <param name="IsTransfer"></param>
        /// <param name="sTransfer"></param>
        /// <param name="PageCurrent"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageCount"></param>
        /// <param name="sqlwhere">查询条件</param>
        /// <returns></returns>
        DataTable GetCustList(string ConStr, string BusinessStaffID, bool IsTransfer, string sTransfer, int PageCurrent, int PageSize, ref int PageCount, string sqlwhere);
        


    }
}
